import React from "react";
import proptypes from "proptypes";
import sonStyle from "./Son.module.css";
import classnames from "classnames/bind";
import GrandSon from "./GrandSon";

let bindClassnames = classnames.bind(sonStyle);
// import sonStyle from "./Son.module.css";
// console.log(sonStyle);
// let str = classnames({
//   son: true,
//   son1: true,
// });
export const context1 = React.createContext();

class Son extends React.PureComponent {
  constructor(props) {
    console.log(props, "props");
    super(props);
  }
  state = {
    name: "小猪",
    hasSon1: true,
  };
  render() {
    console.log("render-son");
    return (
      <>
        <context1.Provider value={this.state.name}>
          <GrandSon></GrandSon>
        </context1.Provider>
      </>
    );
  }
}
// props静态验证
Son.propTypes = {
  age: proptypes.string,
};

// props 默认值
Son.defaultProps = {
  age: "50",
};

export default Son;
